﻿@using NetCoreCMS.EasyNews.Models
@using System.Collections
@{
    var i = 0;
}
@model NewsViewModel

<div class="@Model.ColumnClass">
    @if (Model.HeaderTitle != "" || Model.FooterTitle != "")
    {
        <div class='panel panel-default'>
            @if (Model.HeaderTitle != "")
            {
                <div class='panel-heading' style="color:@Model.HeaderColor; background-color:@Model.HeaderBgColor;">
                    @_T[Model.HeaderTitle]
                </div>
            }
            <div class='panel-body' style="color:@Model.ColumnColor; background-color:@Model.ColumnBgColor;">
                <marquee behavior="scroll" direction="up" scrollamount="@Model.Scrollamount" height="@Model.Height">
                    @foreach (var item in Model.NewsList)
                    {
                        NewsDetails details = item.Details.Where(x => x.Language == CurrentLanguage).FirstOrDefault();
                        if (details == null)
                        {
                            details = item.Details.FirstOrDefault();
                        }
                        if (details != null)
                        {
                            if (i == 0)
                            {
                                i = 1;
                            }
                            else
                            {
                                <hr />
                            }
                            <span><a href="/NeNews/Details?newsId=@item.Id"><font color="@Model.ColumnColor">@Html.Raw(details.Name)</font></a></span>
                        }

                    }
                </marquee>
            </div>
            @if (Model.FooterTitle != "")
            {
                <div class='panel-footer' style="color:@Model.FooterColor; background-color:@Model.FooterBgColor;">
                    @_T[Model.FooterTitle]
                </div>
            }
        </div>
    }
    else
    {
        <div style="color:@Model.ColumnColor; background-color:@Model.ColumnBgColor;">
            <marquee behavior="scroll" direction="up" scrollamount="@Model.Scrollamount" height="@Model.Height">
                @foreach (var item in Model.NewsList)
                {
                    NewsDetails details = item.Details.Where(x => x.Language == CurrentLanguage).FirstOrDefault();
                    if (details == null)
                    {
                        details = item.Details.FirstOrDefault();
                    }
                    if (details != null)
                    {
                        if (i == 0)
                        {
                            i = 1;
                        }
                        else
                        {
                            <hr />
                        }
                        <span><a href="/NeNews/Details?newsId=@item.Id"><font color="@Model.ColumnColor">@Html.Raw(details.Name)</font></a></span>
                    }

                }
            </marquee>
        </div>
    }
</div>


